package com.example.mapper;

import com.example.model.SysRole;
import jdk.nashorn.internal.objects.annotations.Setter;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;
import java.util.Set;

public interface SysRoleMapper extends Mapper<SysRole> {

    @Select(value = "select r.* from sys_role r,sys_user_role ur where r.role_code = ur.role_id and  ur.user_id = #{userId}")
    public List<SysRole> findRoleListByUserId(String userId);

    @Select(value = "select ur.role_id from user_info u inner join sys_user_role ur on u.user_id = ur.user_id where u.account=#{username}")
    public Set<String> finRoleByAccount(String account);

    @Select(value = "select rf.module_id from user_info u inner join sys_role_fun rf on u.role_id = rf.role_id where u.account=#{username}" )
    public Set<String> findModuleByAccount(String account);

}


